﻿using System;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
public partial class Main_Inventory_PODetails : System.Web.UI.Page
{
    Datautility DU = new Datautility();
    NumToWords RupeeInWord = new NumToWords();
    string strsql = "";
    string POID = "";
    string BillFormatID = "";
    int rowcounter = 20;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.QueryString["Poid"] != null)
        {
            POID = Request.QueryString["Poid"].ToString();           
        }
        if (!IsPostBack)
        {
            BindPOMain();
            BindPODetails();
        }

    }
    protected void BindPOMain()
    {
        if (POID != string.Empty)
        {
            string PoMainVoucher = "";
            string PoPrefix = "";
            string PoSuffix = "";
            string PoVoucher = "";
            SqlParameter[] sparam =
                                    {
                                        new SqlParameter("@POID",Request.QueryString["Poid"].ToString())
                                    };
            DataTable DTPOMain = DU.getdatausingprocedure("USP_ACC_GetDetails_POMain", sparam);

            BillFormatID = DTPOMain.Rows[0]["BillFormatId"].ToString();
            //----------------------Billing Company Details-------
            if (DTPOMain.Rows[0]["BillingAddress"].ToString() != string.Empty)
            {
                lblcompanyname.Text = DTPOMain.Rows[0]["BillingAddress"].ToString();
            }
            //-----------------supplier Details---------------------
            if (DTPOMain.Rows[0]["TITLE"].ToString() != string.Empty)
            {
                lblsupplier.Text += "<B>" + DTPOMain.Rows[0]["TITLE"].ToString() + "</B> ";
            }
            if (DTPOMain.Rows[0]["LNAME"].ToString() != string.Empty)
            {
                lblsupplier.Text += "<B>" + DTPOMain.Rows[0]["LNAME"].ToString()+"</B><BR/>";
            }
            if (DTPOMain.Rows[0]["ADDRESS1"].ToString() != string.Empty)
            {
                lblsupplier.Text += DTPOMain.Rows[0]["ADDRESS1"].ToString() + ", ";
            }
            if (DTPOMain.Rows[0]["ADDRESS2"].ToString() != string.Empty)
            {
                lblsupplier.Text += DTPOMain.Rows[0]["ADDRESS2"].ToString() + "<BR/>";
            }
            if (DTPOMain.Rows[0]["ADDRESS3"].ToString() != string.Empty)
            {
                lblsupplier.Text += DTPOMain.Rows[0]["ADDRESS3"].ToString() + ",<BR/>";
            }
            if (DTPOMain.Rows[0]["PLACE"].ToString() != string.Empty)
            {
                lblsupplier.Text += DTPOMain.Rows[0]["PLACE"].ToString()+" ";
            }
            if (DTPOMain.Rows[0]["PINCODE"].ToString() != string.Empty)
            {
                lblsupplier.Text += DTPOMain.Rows[0]["PINCODE"].ToString()+ "<BR/>";
            }
            if (DTPOMain.Rows[0]["STATENAME"].ToString() != string.Empty)
            {
                lblsupplier.Text += DTPOMain.Rows[0]["STATENAME"].ToString()+" ";
            }
            if (DTPOMain.Rows[0]["COUNTRY"].ToString() != string.Empty)
            {
                lblsupplier.Text += DTPOMain.Rows[0]["COUNTRY"].ToString();
            }
            //-----------------Purchase order number-------------------
            if (DTPOMain.Rows[0]["PoPrefix"].ToString() != string.Empty)
            {
                PoPrefix = DTPOMain.Rows[0]["PoPrefix"].ToString()+"/";
            }
            if (DTPOMain.Rows[0]["PoVoucherNo"].ToString() != string.Empty)
            {
                PoVoucher = DTPOMain.Rows[0]["PoVoucherNo"].ToString();
            }
            if (DTPOMain.Rows[0]["PoSuffix"].ToString() != string.Empty)
            {
                PoSuffix = "/"+DTPOMain.Rows[0]["PoSuffix"].ToString();
            }
            PoMainVoucher = PoPrefix + PoVoucher + PoSuffix;
            lblorderno.Text = PoMainVoucher.ToString();
            //---------------Purchase Order Date-------------------
            if (DTPOMain.Rows[0]["PODate"].ToString() != string.Empty)
            {
                if (Convert.ToDateTime(DTPOMain.Rows[0]["PODate"].ToString()) == Convert.ToDateTime("01/01/1900"))
                {
                    lbldate.Text = "";
                }
                else
                {
                    lbldate.Text = string.Format("{0:dd-MMM-yyyy}", Convert.ToDateTime(DTPOMain.Rows[0]["PODate"].ToString()));
                }
            }
            else
            {
                lbldate.Text = "";
            }
            //-------------------------Terms of payment--------------
            if (DTPOMain.Rows[0]["Cash_Credit"].ToString() != string.Empty)
            {
                if (DTPOMain.Rows[0]["Cash_Credit"].ToString() == "1")
                {
                    lblpaymentmode.Text = "Credit";
                }
                else
                {
                        lblpaymentmode.Text = "Cash/Cheque";
                }
            }
            //----------------------Other Reference-------------
            string BillReffDate = "";
            if (DTPOMain.Rows[0]["BillReffDate"].ToString() != string.Empty)
            {
                if (Convert.ToDateTime(DTPOMain.Rows[0]["BillReffDate"].ToString()) == Convert.ToDateTime("01/01/1900"))
                {
                    BillReffDate= "";
                }
                else
                {
                    BillReffDate =" - "+ string.Format("{0:dd/MM/yyyy}", Convert.ToDateTime(DTPOMain.Rows[0]["BillReffDate"].ToString()));
                }
            }
            if (DTPOMain.Rows[0]["BillReff"].ToString() != string.Empty)
            {
                lblotherref.Text = DTPOMain.Rows[0]["BillReff"].ToString() + BillReffDate;
            }

            LblGTotal.Text = Convert.ToDouble(DTPOMain.Rows[0]["GrandTotal"].ToString()).ToString("N2");
            //lblamountinwords.Text = RupeeInWord.ToWords(Convert.ToDouble(DTPOMain.Rows[0]["GrandTotal"].ToString())).ToString();
        }

        strsql = "Select * from ACC_COMPANY";
        DataTable DTAdd = DU.getdata(strsql);
        if (DTAdd.Rows.Count > 0)
        {
            lblcompany.Text = "for " + DTAdd.Rows[0]["CompName"].ToString();
            lblcompanyvat.Text = DTAdd.Rows[0]["vatno"].ToString();
            lblcompanyservicetaxno.Text = DTAdd.Rows[0]["SERTNo"].ToString();
            lblcompanypan.Text = DTAdd.Rows[0]["pan"].ToString();
        }


    }
    protected void BindPODetails()
    {
        if (POID != string.Empty && BillFormatID != string.Empty)
        {
            DataTable DTCustom = new DataTable();
            DTCustom.Columns.Add("Sno");
            DTCustom.Columns.Add("Item");
            DTCustom.Columns.Add("Qty");
            DTCustom.Columns.Add("Unit");
            DTCustom.Columns.Add("Rate");
            DTCustom.Columns.Add("Amount");
            DTCustom.Columns.Add("Vat");
            DTCustom.Columns.Add("TaxRate");
            DTCustom.Columns.Add("TaxAmt");
            DTCustom.Columns.Add("Total");            
            strsql = "Select * From ACC_PODETAILS Where Poid='"+POID.ToString()+"'";
            DataTable DTPODetails = DU.getdata(strsql);
            if (DTPODetails.Rows.Count > 0)
            {
                HtmlTableRow HTRow = new HtmlTableRow();
                HTRow.Style.Add("height", "5%");

                HtmlTableCell HTCellSNo = new HtmlTableCell();              
                HTCellSNo.Style.Add("border-right", "1px solid #C0C0C0");
                HTCellSNo.Style.Add("border-bottom", "1px solid #C0C0C0");
                HTCellSNo.Style.Add("text-align", "center");
                HTCellSNo.Style.Add("width", "4%");
                HTCellSNo.InnerHtml = "<b>S.No.</b>";

                HtmlTableCell HTCellItem = new HtmlTableCell();
                HTCellItem.Style.Add("border-right", "1px solid #C0C0C0");
                HTCellItem.Style.Add("border-bottom", "1px solid #C0C0C0");
                HTCellItem.Style.Add("padding-left", "5px");
                HTCellItem.Style.Add("text-align", "left");
                HTCellItem.Style.Add("width", "23%");
                HTCellItem.InnerHtml = "<b>Description of Goods</b>";

                HtmlTableCell HTCellQty = new HtmlTableCell();
                HTCellQty.Style.Add("border-right", "1px solid #C0C0C0");
                HTCellQty.Style.Add("border-bottom", "1px solid #C0C0C0");
                HTCellQty.Style.Add("text-align", "right");
                HTCellQty.Style.Add("padding-right", "5px");
                HTCellQty.Style.Add("width", "7%");
                HTCellQty.InnerHtml = "<b>Quantity</b>";

                HtmlTableCell HTCellRate = new HtmlTableCell();
                HTCellRate.Style.Add("border-right", "1px solid #C0C0C0");
                HTCellRate.Style.Add("border-bottom", "1px solid #C0C0C0");
                HTCellRate.Style.Add("text-align", "right");
                HTCellRate.Style.Add("padding-right", "5px");
                HTCellRate.Style.Add("width", "8%");
                HTCellRate.InnerHtml = "<b>Rate</b>";

                HtmlTableCell HTCellUnit = new HtmlTableCell();
                HTCellUnit.Style.Add("border-right", "1px solid #C0C0C0");
                HTCellUnit.Style.Add("border-bottom", "1px solid #C0C0C0");
                HTCellUnit.Style.Add("text-align", "left");
                HTCellUnit.Style.Add("padding-left", "5px");
                HTCellUnit.Style.Add("width", "8%");
                HTCellUnit.InnerHtml = "<b>Per</b>";

                HtmlTableCell HTCellAmt = new HtmlTableCell();
                HTCellAmt.Style.Add("border-right", "1px solid #C0C0C0");
                HTCellAmt.Style.Add("border-bottom", "1px solid #C0C0C0");
                HTCellAmt.Style.Add("text-align", "right");
                HTCellAmt.Style.Add("padding-right", "5px");
                HTCellAmt.Style.Add("width", "12%");
                HTCellAmt.InnerHtml = "<b>Amount</b>";

                HtmlTableCell HTCellVat = new HtmlTableCell();
                HTCellVat.Style.Add("border-right", "1px solid #C0C0C0");
                HTCellVat.Style.Add("border-bottom", "1px solid #C0C0C0");
                HTCellVat.Style.Add("text-align", "left");
                HTCellVat.Style.Add("padding-left", "5px");
                HTCellVat.Style.Add("width", "8%");
                HTCellVat.InnerHtml = "<b>VAT/CST</b>";

                HtmlTableCell HTCellTaxRate = new HtmlTableCell();
                HTCellTaxRate.Style.Add("border-right", "1px solid #C0C0C0");
                HTCellTaxRate.Style.Add("border-bottom", "1px solid #C0C0C0");
                HTCellTaxRate.Style.Add("text-align", "right");
                HTCellTaxRate.Style.Add("padding-right", "5px");
                HTCellTaxRate.Style.Add("width", "8%");
                HTCellTaxRate.InnerHtml = "<b>Tax Rate(%)</b>";

                HtmlTableCell HTCellTaxAmt = new HtmlTableCell();
                HTCellTaxAmt.Style.Add("border-right", "1px solid #C0C0C0");
                HTCellTaxAmt.Style.Add("border-bottom", "1px solid #C0C0C0");
                HTCellTaxAmt.Style.Add("text-align", "right");
                HTCellTaxAmt.Style.Add("padding-right", "5px");
                HTCellTaxAmt.Style.Add("width", "10%");
                HTCellTaxAmt.InnerHtml = "<b>Tax Amount</b>";

                HtmlTableCell HTCellTotalAmt = new HtmlTableCell();
                HTCellTotalAmt.Style.Add("text-align", "right");
                HTCellTotalAmt.Style.Add("border-bottom", "1px solid #C0C0C0");
                HTCellTotalAmt.Style.Add("padding-right", "5px");
                HTCellTotalAmt.Style.Add("width", "15%");
                HTCellTotalAmt.InnerHtml = "<b>Total Amount</b>";

                HTRow.Cells.Add(HTCellSNo);
                HTRow.Cells.Add(HTCellItem);
                HTRow.Cells.Add(HTCellQty);
                HTRow.Cells.Add(HTCellRate);
                HTRow.Cells.Add(HTCellUnit);
                HTRow.Cells.Add(HTCellAmt);
                HTRow.Cells.Add(HTCellVat);
                HTRow.Cells.Add(HTCellTaxRate);
                HTRow.Cells.Add(HTCellTaxAmt);
                HTRow.Cells.Add(HTCellTotalAmt);
                TblItems.Rows.Add(HTRow);

                for (int i = 0; i < DTPODetails.Rows.Count; i++)
                {
                    DataRow DR = DTCustom.NewRow();
                    DR[0] = (i + 1).ToString();
                    strsql = "select ITEMTYPE from IVR_TRANFORMAT Where TFOID='" + BillFormatID.ToString()+ "'";
                    DataTable DTFormat = DU.getdata(strsql);
                    if (DTFormat.Rows.Count > 0)
                    {
                        strsql = "select ITMCODE, ITMDESC from IVR_ITEM where ITMID='"+DTPODetails.Rows[i]["ItemId"].ToString()+"'";
                        DataTable DT = DU.getdata(strsql);
                        if (DT.Rows.Count > 0)                        {
                            
                            if (DTFormat.Rows[0]["ITEMTYPE"].ToString() == "False")
                            {
                                DR[1] = DT.Rows[0]["ITMDESC"].ToString();
                            }
                            else
                            {
                                DR[1] = DT.Rows[0]["ITMCODE"].ToString();
                            }                            
                        }
                    }
                    DR[2] = Math.Round(Convert.ToDecimal(DTPODetails.Rows[i]["ItemQty"].ToString()), 2).ToString();
                    DR[3] = Math.Round(Convert.ToDecimal(DTPODetails.Rows[i]["RateExclTax"].ToString()), 2).ToString();
                    strsql = "Select UOMSYMBOL from IVR_UOM Where UOMID='"+DTPODetails.Rows[i]["UOMID"].ToString()+"'";
                    DataTable DTUOM = DU.getdata(strsql);
                    if (DTUOM.Rows.Count > 0)
                    {
                        DR[4] = DTUOM.Rows[0]["UOMSYMBOL"].ToString();
                    }
                    DR[5] = Math.Round(Convert.ToDecimal(DTPODetails.Rows[i]["TaxableAmt"].ToString()), 2).ToString();
                    if(Convert.ToDouble(DTPODetails.Rows[i]["TaxTypeId"].ToString())>0)
                    {
                        strsql = "SELECT SUBCLASSNAME,TAXRATE from UVW_ACC_TaxDetails where MAINCLASSID='" + DTPODetails.Rows[i]["TaxGroupId"].ToString() + "' AND SUBCLASSID='" + DTPODetails.Rows[i]["TaxTypeId"].ToString() + "'";
                        DataTable DT = DU.getdata(strsql);
                        if (DT.Rows.Count > 0)
                        {
                            DR[6] = DT.Rows[0]["SUBCLASSNAME"].ToString();                          
                            DR[7] =DT.Rows[0]["TAXRATE"].ToString().Trim();
                            DR[8] = Math.Round(Convert.ToDecimal(DTPODetails.Rows[i]["TaxAmt"].ToString()), 2).ToString();
                        }
                        else
                        {
                            DR[6] = "";
                            DR[7] = "";
                            DR[8] = "";
                        }

                    }
                    else
                    {
                        DR[6] = "";
                        DR[7] = "";
                        DR[8] = "";
                    }
                    DR[9] = Math.Round(Convert.ToDecimal(DTPODetails.Rows[i]["TotalAmount"].ToString()), 2).ToString();
                    DTCustom.Rows.Add(DR);
                }
                
            }
            if (DTCustom.Rows.Count > 0)
            {
                for (int i = 0; i < DTCustom.Rows.Count; i++)
                {
                    HtmlTableRow HTRow_x = new HtmlTableRow();
                    HTRow_x.Style.Add("height", "5%");

                    HtmlTableCell HTCellSNo_x = new HtmlTableCell();
                    HTCellSNo_x.Style.Add("border-right", "1px solid #C0C0C0");
                    HTCellSNo_x.Style.Add("border-bottom", "1px solid #C0C0C0");
                    HTCellSNo_x.Style.Add("text-align", "center");
                    HTCellSNo_x.Style.Add("width", "4%");
                    HTCellSNo_x.InnerText = DTCustom.Rows[i]["Sno"].ToString();

                    HtmlTableCell HTCellItem_x = new HtmlTableCell();
                    HTCellItem_x.Style.Add("border-right", "1px solid #C0C0C0");
                    HTCellItem_x.Style.Add("border-bottom", "1px solid #C0C0C0");
                    HTCellItem_x.Style.Add("padding-left", "5px");
                    HTCellItem_x.Style.Add("text-align", "left");
                    HTCellItem_x.Style.Add("width", "23%");
                    HTCellItem_x.InnerText = DTCustom.Rows[i]["Item"].ToString();

                    HtmlTableCell HTCellQty_x = new HtmlTableCell();
                    HTCellQty_x.Style.Add("border-right", "1px solid #C0C0C0");
                    HTCellQty_x.Style.Add("border-bottom", "1px solid #C0C0C0");
                    HTCellQty_x.Style.Add("text-align", "right");
                    HTCellQty_x.Style.Add("padding-right", "5px");
                    HTCellQty_x.Style.Add("width", "7%");
                    HTCellQty_x.InnerText = DTCustom.Rows[i]["Qty"].ToString();

                    HtmlTableCell HTCellRate_x = new HtmlTableCell();
                    HTCellRate_x.Style.Add("border-right", "1px solid #C0C0C0");
                    HTCellRate_x.Style.Add("border-bottom", "1px solid #C0C0C0");
                    HTCellRate_x.Style.Add("text-align", "right");
                    HTCellRate_x.Style.Add("padding-right", "5px");
                    HTCellRate_x.Style.Add("width", "8%");
                    HTCellRate_x.InnerText = DTCustom.Rows[i]["Unit"].ToString();

                    HtmlTableCell HTCellUnit_x = new HtmlTableCell();
                    HTCellUnit_x.Style.Add("border-right", "1px solid #C0C0C0");
                    HTCellUnit_x.Style.Add("border-bottom", "1px solid #C0C0C0");
                    HTCellUnit_x.Style.Add("text-align", "left");
                    HTCellUnit_x.Style.Add("padding-left", "5px");
                    HTCellUnit_x.Style.Add("width", "8%");
                    HTCellUnit_x.InnerText = DTCustom.Rows[i]["Rate"].ToString();

                    HtmlTableCell HTCellAmt_x = new HtmlTableCell();
                    HTCellAmt_x.Style.Add("border-right", "1px solid #C0C0C0");
                    HTCellAmt_x.Style.Add("border-bottom", "1px solid #C0C0C0");
                    HTCellAmt_x.Style.Add("text-align", "right");
                    HTCellAmt_x.Style.Add("padding-right", "5px");
                    HTCellAmt_x.Style.Add("width", "12%");
                    HTCellAmt_x.InnerText = DTCustom.Rows[i]["Amount"].ToString();

                    HtmlTableCell HTCellVat_x = new HtmlTableCell();
                    HTCellVat_x.Style.Add("border-right", "1px solid #C0C0C0");
                    HTCellVat_x.Style.Add("border-bottom", "1px solid #C0C0C0");
                    HTCellVat_x.Style.Add("text-align", "left");
                    HTCellVat_x.Style.Add("padding-left", "5px");
                    HTCellVat_x.Style.Add("width", "8%");
                    HTCellVat_x.InnerText = DTCustom.Rows[i]["Vat"].ToString();

                    HtmlTableCell HTCellTaxRate_x = new HtmlTableCell();
                    HTCellTaxRate_x.Style.Add("border-right", "1px solid #C0C0C0");
                    HTCellTaxRate_x.Style.Add("border-bottom", "1px solid #C0C0C0");
                    HTCellTaxRate_x.Style.Add("text-align", "right");
                    HTCellTaxRate_x.Style.Add("padding-right", "5px");
                    HTCellTaxRate_x.Style.Add("width", "8%");
                    HTCellTaxRate_x.InnerText = DTCustom.Rows[i]["TaxRate"].ToString();

                    HtmlTableCell HTCellTaxAmt_x = new HtmlTableCell();
                    HTCellTaxAmt_x.Style.Add("border-right", "1px solid #C0C0C0");
                    HTCellTaxAmt_x.Style.Add("border-bottom", "1px solid #C0C0C0");
                    HTCellTaxAmt_x.Style.Add("text-align", "right");
                    HTCellTaxAmt_x.Style.Add("padding-right", "5px");
                    HTCellTaxAmt_x.Style.Add("width", "10%");
                    HTCellTaxAmt_x.InnerText = DTCustom.Rows[i]["TaxAmt"].ToString();

                    HtmlTableCell HTCellTotalAmt_x = new HtmlTableCell();
                    HTCellTotalAmt_x.Style.Add("text-align", "right");
                    HTCellTotalAmt_x.Style.Add("border-bottom", "1px solid #C0C0C0");
                    HTCellTotalAmt_x.Style.Add("padding-right", "5px");
                    HTCellTotalAmt_x.Style.Add("width", "15%");
                    HTCellTotalAmt_x.InnerText = DTCustom.Rows[i]["Total"].ToString();

                    HTRow_x.Cells.Add(HTCellSNo_x);
                    HTRow_x.Cells.Add(HTCellItem_x);
                    HTRow_x.Cells.Add(HTCellQty_x);
                    HTRow_x.Cells.Add(HTCellRate_x);
                    HTRow_x.Cells.Add(HTCellUnit_x);
                    HTRow_x.Cells.Add(HTCellAmt_x);
                    HTRow_x.Cells.Add(HTCellVat_x);
                    HTRow_x.Cells.Add(HTCellTaxRate_x);
                    HTRow_x.Cells.Add(HTCellTaxAmt_x);
                    HTRow_x.Cells.Add(HTCellTotalAmt_x);
                    TblItems.Rows.Add(HTRow_x);
                }
            }
            int rem = rowcounter - DTPODetails.Rows.Count;


            for (int i = 0; i < rem; i++)
            {
                HtmlTableRow HTRowBlank = new HtmlTableRow();
                HTRowBlank.Style.Add("height", "5%");

                HtmlTableCell HTCell0 = new HtmlTableCell();
                //HTCellSNo.Style.Add("border-top", "1px solid");
                HTCell0.Style.Add("border-right", "1px solid #C0C0C0");
                HTCell0.Style.Add("text-align", "center");
                //HTCellSNo.Style.Add("width", "4%");
                HTCell0.InnerHtml = "&nbsp;";


                HtmlTableCell HTCell1 = new HtmlTableCell();
                //HTCell1.Style.Add("border-top", "1px solid");
                HTCell1.Style.Add("border-right", "1px solid #C0C0C0");
                HTCell1.Style.Add("padding-left", "5px");
                HTCell1.Style.Add("text-align", "left");
                //HTCell1.Style.Add("width", "46%");
                HTCell1.InnerHtml = "&nbsp;";

                HtmlTableCell HTCell2 = new HtmlTableCell();
                //HTCell2.Style.Add("border-top", "1px solid");
                HTCell2.Style.Add("border-right", "1px solid #C0C0C0");
                HTCell2.Style.Add("text-align", "right");
                HTCell1.Style.Add("padding-left", "5px");
                //HTCell2.Style.Add("width", "10%");
                HTCell2.InnerHtml = "&nbsp;";

                HtmlTableCell HTCell3 = new HtmlTableCell();
                // HTCell3.Style.Add("border-top", "1px solid");
                HTCell3.Style.Add("border-right", "1px solid #C0C0C0");
                HTCell3.Style.Add("text-align", "right");
                HTCell1.Style.Add("padding-left", "5px");
                //HTCell3.Style.Add("width", "10%");
                HTCell3.InnerHtml = "&nbsp;";

                HtmlTableCell HTCell4 = new HtmlTableCell();
                //HTCell4.Style.Add("border-top", "1px solid");
                HTCell4.Style.Add("border-right", "1px solid #C0C0C0");
                HTCell4.Style.Add("text-align", "left");

                HTCell4.Style.Add("padding-left", "5px");
                //HTCell4.Style.Add("width", "10%");
                HTCell4.InnerHtml = "&nbsp;";

                HtmlTableCell HTCell5 = new HtmlTableCell();
                //HTCell5.Style.Add("border-top", "1px solid");
                HTCell5.Style.Add("border-right", "1px solid #C0C0C0");
                HTCell5.Style.Add("text-align", "right");
                HTCell1.Style.Add("padding-left", "5px");
                //HTCell5.Style.Add("width", "10%");
                HTCell5.InnerHtml = "&nbsp;";

                HtmlTableCell HTCell6 = new HtmlTableCell();
                // HTCell6.Style.Add("border-top", "1px solid");
                HTCell6.Style.Add("border-right", "1px solid #C0C0C0");
                HTCell6.Style.Add("text-align", "left");
                HTCell6.Style.Add("padding-left", "5px");
                //HTCell6.Style.Add("width", "10%");
                HTCell6.InnerHtml = "&nbsp;";

                HtmlTableCell HTCell7 = new HtmlTableCell();
                // HTCell7.Style.Add("border-top", "1px solid");
                HTCell7.Style.Add("border-right", "1px solid #C0C0C0");
                HTCell7.Style.Add("text-align", "right");
                HTCell1.Style.Add("padding-left", "5px");
                //HTCell7.Style.Add("width", "8%");
                HTCell7.InnerHtml = "&nbsp;";

                HtmlTableCell HTCell8 = new HtmlTableCell();
                // HTCell8.Style.Add("border-top", "1px solid");
                HTCell8.Style.Add("border-right", "1px solid #C0C0C0");
                HTCell8.Style.Add("text-align", "right");
                HTCell1.Style.Add("padding-right", "5px");
                //HTCell8.Style.Add("width", "10%");
                HTCell8.InnerHtml = "&nbsp;";

                HtmlTableCell HTCell9 = new HtmlTableCell();
                // HTCell9.Style.Add("border-top", "1px solid #C0C0C0");
                // HTCell9.Style.Add("border-right", "1px solid #C0C0C0");
                HTCell9.Style.Add("text-align", "right");
                HTCell1.Style.Add("padding-right", "5px");
                //HTCell9.Style.Add("width", "12%");
                HTCell9.InnerHtml = "&nbsp;";

                HTRowBlank.Cells.Add(HTCell0);
                HTRowBlank.Cells.Add(HTCell1);
                HTRowBlank.Cells.Add(HTCell2);
                HTRowBlank.Cells.Add(HTCell3);
                HTRowBlank.Cells.Add(HTCell4);
                HTRowBlank.Cells.Add(HTCell5);
                HTRowBlank.Cells.Add(HTCell6);
                HTRowBlank.Cells.Add(HTCell7);
                HTRowBlank.Cells.Add(HTCell8);
                HTRowBlank.Cells.Add(HTCell9);
                TblItems.Rows.Add(HTRowBlank);

            }
        }
    }
}




